import numpy as np

Idt = np.identity(3)
print(Idt)

moveM = np.array([[1, 0, 1], [0, 1, 2], [0, 0, 1]])

# rotate 30 degrees
theta = np.pi / 6
rotateM = np.array([[np.cos(theta), -np.sin(theta), 0], [np.sin(theta), np.cos(theta), 0], [0, 0, 1]])

# print(rotateM)

# scale by 0.5
scaleM = np.array([[0.5, 0, 0], [0, 0.5, 0], [0, 0, 1]])

# combine all transformations
transM = scaleM @ rotateM @ moveM
print(transM.reshape(1, 9).tolist()[0])

print(np.linalg.inv(transM).reshape(1, 9).tolist()[0])